package atm05;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 改密界面
 */
public class ChangePwdPanel extends JPanel{
    private JLabel oldPwd = new JLabel("输入原密码：");
    private JLabel newPwd01 = new JLabel("输入新密码：");
    private JLabel newPwd02 = new JLabel("再次输入新密码：");
    private JPasswordField oldPwdText = new JPasswordField();
    private JPasswordField newPwd01Text = new JPasswordField();
    private JPasswordField newPwd02Text = new JPasswordField();
    private JButton sureBtn = new JButton(new ImageIcon("src/atm05/Images/buttonSure.jpg"));
    private JButton exitBtn = new JButton(new ImageIcon("src/atm05/Images/buttonOff.jpg"));
    private Font font = new Font("黑体",Font.BOLD,25);

    public ChangePwdPanel(ATM05 atm05) {
        this.setLayout(null);

        oldPwd.setBounds(300,200,220,50);
        oldPwd.setFont(font);

        newPwd01.setBounds(300,300,220,50);
        newPwd01.setFont(font);

        newPwd02.setBounds(300,400,220,50);
        newPwd02.setFont(font);

        oldPwdText.setBounds(530,200,220,50);

        newPwd01Text.setBounds(530,300,220,50);

        newPwd02Text.setBounds(530,400,220,50);

        sureBtn.setBounds(420,520,140,50);

        exitBtn.setBounds(880,380,140,50);
        exitBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                atm05.showPanel("menu");
            }
        });

        this.add(oldPwd);
        this.add(newPwd01);
        this.add(newPwd02);
        this.add(oldPwdText);
        this.add(newPwd01Text);
        this.add(newPwd02Text);
        this.add(sureBtn);
        this.add(exitBtn);

        this.setOpaque(false);
    }
}
